const express = require('express');
const {addAskService, getAskListService, updateAskByIdService, getAskByIdService} = require("../service/askService");
const router = express.Router();

// 添加咨询
router.post('/', async function (req, res, next) {
    res.send(await addAskService(req.body))
})
// 获取咨询列表
router.get('/', async function (req, res, next) {
    res.send(await getAskListService())
})
// 根据id更新单个咨询信息
router.put('/:id', async function (req, res, next) {
    console.log(req.body)
    res.send(await updateAskByIdService(req.params.id, req.body))
})
// 根据 id 获取单个咨询信息
router.get('/:id', async function (req, res, next) {
    res.send(await getAskByIdService(req.params.id))
})

module.exports = router;
